package cn.liulingfengyu.creationmode.singletonpattern;

/**
 * 单例模式示例 - 测试类
 */
public class SingletonPatternDemo {
    public static void main(String[] args) {
        // 获取单例实例
        Singleton singleton = Singleton.getInstance();
        singleton.showMessage();

        // 再次获取单例实例，验证是否为同一个对象
        Singleton anotherSingleton = Singleton.getInstance();
        System.out.println("两个实例是否相同: " + (singleton == anotherSingleton));
    }
}